using UnityEngine;

public class UIshake : MonoBehaviour
{
	public Transform m_transform;

	public bool isshake;

	private float shake;

	private void Update()
	{
		if (isshake)
		{
			m_transform.localPosition = new Vector3(UnityEngine.Random.Range(0f, shake * 2f) - shake, UnityEngine.Random.Range(0f, shake * 2f) - shake, 0f);
			shake /= 1.1f;
			if (shake < 0.05f)
			{
				stopshake();
			}
		}
	}

	public void showshake()
	{
		shake = 6f;
		isshake = true;
	}

	public void stopshake()
	{
		shake = 0f;
		m_transform.localPosition = Vector3.zero;
		isshake = false;
	}
}
